package cn.shanke.torrentmanagerserver.dao;

import cn.shanke.torrentmanagerserver.model.TorrentInClient;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;


@Mapper
public interface TorrentInClientMapper extends BaseMapper<TorrentInClient> {

    @Select("SELECT count(1) as num,torrentid FROM torrent_in_client WHERE torrentid IN(${torrentids}) GROUP BY torrentid")
    List<Map<String, Object>> countClients(@Param("torrentids") String torrentids);
}
